<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    async function async () {
      // await async2()
      // // 必须等上面的await执行完毕之后才会执行下面的
      // new Promise((resolve, reject) => {
      //   console.log(111);
      //   resolve()
      // })
      await async2().then(res => {
        new Promise((resolve, reject) => {
          console.log(2222);
          resolve()
        })
      })
      // 必须等上面的await执行完毕之后才会执行下面的
    }
    function async2 () {
      return new Promise((resolve, reject) => {
        console.log(111);
        resolve()
      })
    }
    async()
  </script>
</body>

</html>